<template>
  <div class="list-box">
    <div
      class="list-item box-border f-row jc-sb ai-c"
      @click="jumpPages(i.url, i.id)"
      v-for="i in list"
      :key="i.id"
    >
      <div class="f-row ai-c">
        <img :src="i.iconUrl" mode="" class="icon" />
        <text>
          {{ i.title }}
        </text>
      </div>
      <div class="right">
        <span class="circle" v-if="i.id == 6 && isRead"></span>
		<van-icon name="arrow" size="20" color="#979797" />
      </div>
    </div>
    <u-modal
      :show="show"
      :closeOnClickOverlay="true"
      :showCancelButton="true"
      :title="'提示'"
      @confirm="confirm"
      @cancel="cancel"
      :content="'是否退出登录？'"
      confirmColor="#157DFA"
    ></u-modal>
  </div>
</template>

<script setup>
import { showToast } from 'vant';
import { getAssetURL } from "@/utils/load_assets.js";
import { reactive ,ref,onMounted} from "vue";
import {useRouter} from 'vue-router'
const router = useRouter()
let localInfo = localStorage.getItem('userinfo1')
let token = localInfo ? JSON.parse(localInfo).token : ''
import { getReadInfo } from "@/services/modules/home";

let list = reactive([
  {
    id: 1,
    title: "累计分销订单",
    iconUrl: getAssetURL("home/icon/my/1.png"),
    url: "/order",
  },
  {
    id: 2,
    title: "已提现佣金",
    iconUrl: getAssetURL("home/icon/my/2.png"),
    url: `/withdrawDetails`,
  },

  {
    id: 5,
    title: "推广链接",
    iconUrl: getAssetURL("home/icon/my/3.png"),
    url: "/merchantPromotion",
  },
  {
    id: 3,
    title: "员工管理",
    iconUrl: getAssetURL("home/icon/my/4.png"),
    url: "/staff",
  },
  {
    id: 4,
    title: "商铺记录表",
    iconUrl: getAssetURL("home/icon/my/5.png"),
    url: "/productMaps",
  },
  {
    id: 6,
    title: "我的消息",
    iconUrl: getAssetURL("home/icon/my/6.png"),
    url: "/message",
  },
]);
//点击跳转
const jumpPages = (url)=>{
  if(!token){
    showToast('请登录后操作！')
    return;
  }
	router.push({
    path: url,
  })
}
const isRead = ref(false)
const getRead = async ()=>{
  let res = await getReadInfo()
  isRead.value = res.data
  console.log(isRead.value,111)
}
onMounted(()=>{
  getRead()
})
</script>

<style lang="scss" scoped>
.list-box {
  // z-index: 999;
  padding: 0 20px;
  margin-top: 0;
  // border-radius: 40px 40px 0 0;
  background: #fff;
  position: relative;
  // top: -20px;
}
.right {
  display: flex;
  flex-direction: row;
  align-items: center;
}
.je {
  margin-right: 20px;
  color: #081738;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ececec;
  padding: 15px 0;
}

.list-item:last-child {
  border: none;
}

text {
  color: #4d4d4d;
  font-size: 28upx;
}

.icon {
  width: 15.977px;
  height: 14px;
  margin-right: 10px;
}
</style>